<template>
  <div>
    <header-city></header-city>
    <search-city></search-city>
    <list-city :cities="cities" :hotCities="hotCities"></list-city>
    <alohabet-city :cities="cities"></alohabet-city>
  </div>
</template>

<script>
import axios from 'axios'
import HeaderCity from './component/Header'
import SearchCity from './component/Search'
import ListCity from './component/List'
import AlohabetCity from './component/Alphabet'
export default {
  name: 'City',
  components: {
    HeaderCity,
    SearchCity,
    ListCity,
    AlohabetCity
  },
  data () {
    return {
      cities: {},
      hotCities: []
    }
  },
  methods: {
    getCityInfo () {
      axios.get('/api/city.json').then(this.handleGetCityInfoSucc)
    },
    handleGetCityInfoSucc (res) {
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        this.cities = data.cities
        this.hotCities = data.hotCities
      }
    }
  },
  mounted () {
    this.getCityInfo()
  }
}
</script>

<style lang="stylus" scoped>

</style>
